const ajax = window.ajaxFlowApi;

export let organizeDetail = (primaryKey) => {
  return ajax.request(`/v1/organization/management/business/org/info/detail/${primaryKey}`, 'get', {}, {
    showLoading: true
  });
};

/**
 * 新增
 *
 * @param params
 */
export let organizeCreate = (params = {}) => {
  return ajax.request('/v1/organization/management/business/org/info', 'post', params, {
    showLoading: true
  });
};

/**
 * 更新
 *
 * @param params
 */
export let organizeUpdate = (params = {}) => {
  return ajax.request('/v1/organization/management/business/org/info', 'put', params, {
    showLoading: true
  });
};

/**
 * 组织树
 */
export let organizeTree = (treeNodeKey) => {
  return ajax.request(`/v1/organization/management/business/org/info/tree/${treeNodeKey}`, 'get', {}, {
    showLoading: true
  });
};

/**
 * 组织列表
 */
export let organizeList = (params) => {
  return ajax.request('/v1/organization/management/business/org/info/list', 'post', params, {
    showLoading: true
  });
};

/**
 * 删除
 *
 * @param primaryKey
 */
export let organizeDelete = (primaryKey, treeNodekey) => {
  return ajax.request(`/v1/organization/management/business/org/info/${primaryKey}/${treeNodekey}`, 'delete', {}, {
    showLoading: true
  });
};

// 字典
export let organizeDict = () => {
  return ajax.request('/v1/organization/management/business/org/info/dict', 'get');
};

/////v1/organization/node/tree  树列表
export let structureListTree = (params) => {
  return ajax.request('/v1/business/organization/node/trees', 'post', params, {
    showLoading: true
  });
};
// /v1/business/organization/node  添加节点
export let structureAddNode = (params = {}) => {
  return ajax.request('/v1/business/organization/node', 'post', params, {
    showLoading: true
  });
};
// /v1/business/organization/node 更新节点
export let structureNodeUpdate = (params = {}) => {
  return ajax.request('/v1/business/organization/node', 'put', params, {
    showLoading: true
  });
};
// /v1/business/organization/node/{primaryKey}  删除节点
export let structureNodeDelete = (primaryKey) => {
  return ajax.request(`/v1/business/organization/node/${primaryKey}`, 'delete', {}, {
    showLoading: true
  });
};
// /v1/business/organization/node/{primaryKey}
export let structureNodeDetail = (primaryKey) => {
  return ajax.request(`/v1/business/organization/node/${primaryKey}`, 'get', {}, {
    showLoading: true
  });
};
// 克隆/v1/business/organization/node/clone d
export let structureCloneNode = (params = {}) => {
  return ajax.request('/v1/business/organization/node/clone', 'post', params, {
    showLoading: true
  });
};
// /v1/business/organization/node/move  d
export let structureMoveNode = (params = {}) => {
  return ajax.request('/v1/business/organization/node/move', 'post', params, {
    showLoading: true
  });
};
// /v1/business/org/org/employee/list 组织结构员工列表
export let structureStaffList = (params = {}) => {
  return ajax.request('/v1/business/org/org/employee/list', 'post', params, {
    showLoading: true
  });
};
// /v1/business/org/org/employee/{primaryKey} 删除组织结构员工列表
export let tructureStaffDelete = (params) => {
  return ajax.request('/v1/business/org/org/employee', 'delete', params, {
    showLoading: true
  });
};
// 更新组织结构人员 /v1/business/org/org/employee
export let structureOrgStaffUpdate = (params = {}) => {
  return ajax.request('/v1/business/org/org/employee', 'put', params, {
    showLoading: true
  });
};
// //v1/business/org/org/employee  新增人员  d
export let addStaff = (params = {}) => {
  return ajax.request('/v1/business/org/org/employee', 'post', params, {
    showLoading: true
  });
};
export let updateStaff = (params = {}) => {
  return ajax.request('/v1/business/org/org/employee', 'put', params, {
    showLoading: true
  });
};

//获取操作日志 list表数据
export let getList = (params = {}) => {
  return ajax.request('/v1/business/log/org/log/list', 'post', params, {
    showLoading: true
  })
}
//business/log/org/log/recover 恢复
export let setRecover = (params = {}) => {
  return ajax.request('business/log/org/log/recover', 'post', params, {
    showLoading: true
  })
}
//应用列表获取 /v1/business/auth/app/app/list
export let applicationlist = (params = {}) => {
  return ajax.request('/v1/business/auth/app/app/list', 'post', params, {
    showLoading: true
  })
}
// 权限列表  /v1/business/auth/app/opt/list
export let authList = (params = {}) => {
  return ajax.request('/v1/business/auth/app/opt/list', 'post', params, {
    showLoading: true
  })
}
//应用权限 新增
export let add = (params = {}) => {
  return ajax.request('/v1/business/auth/app/create', 'post', params, {
    showLoading: true
  })
}
//应用权限列表获取
export let optlist = (params = {}) => {
  return ajax.request('/v1/business/auth/app/list', 'post', params, {
    showLoading: true
  })
}
// 列表删除 /v1/business/auth/app/delete
export let optDel = (params = {}) => {
  return ajax.request('/v1/business/auth/app/delete', 'post', params, {
    showLoading: true
  })
}
//应用权限编辑
export let optupdate = (params = {}) => {
  return ajax.request('/v1/business/auth/app/update', 'post', params, {
    showLoading: true
  })
}
// /v1/business/org/org/employee/{primaryKey}  结构详情
export let structureStaffDetail = (primaryKey) => {
  return ajax.request(`/v1/business/org/org/employee/${primaryKey}`, 'get', {}, {
    showLoading: true
  });
};
// 人力资源树 /v1/business/organization/node/human/trees
export let getHumanResourceTree = (params) => {
  return ajax.request('/v1/business/organization/node/human/trees', 'post', params, {
    showLoading: true
  });
};
//人员管理  下载表格

export let loadFile = (params) => {
  return ajax.request(`/v1/business/organization/node/template/${params}`, 'get', {}, {
    showLoading: true,
    responseType: 'blob'
  })
}
// 结构人员批量保存 /v1/business/org/org/employee/batch/create d
export let structureBatchCreate = (params) => {
  return ajax.request('/v1/business/org/org/employee/batch/create', 'post', params, {
    showLoading: true
  });
};
// 结构人员批量删除 /v1/business/org/org/employee
export let employeeDelete = (params) => {
  return ajax.request('/v1/business/org/org/employee', 'delete', params, {
    showLoading: true
  });
};
// 节点克隆 /v1/business/organization/node/clone
export let structurePatentImportCloneNode = (params = {}) => {
  return ajax.request('/v1/business/organization/node/clone', 'post', params, {
    showLoading: true
  });
};
// /v1/business/organization/node/import 表格导入
export let nodeTreeExcel = (params = {}) => {
  return ajax.request('/v1/business/organization/node/import', 'post', params, {
    showLoading: true
  });
};
// 节点所属
export let nodeStructureSource = (params = {}) => {
  return ajax.request(`/v1/business/organization/node/structure/node/${params}`, 'get', '', {
    showLoading: true
  });
};

// 员工列表 党 /v1/business/employee/list
export let staffSearchList = (params = {}) => {
    return ajax.request('/v1/business/employee/list', 'post', params, {
      showLoading: true
    });
};